1. Field of the Invention
The present invention relates to a system, method, and program for transferring data from a storage device to a requesting application.
2. Description of the Related Art
Many organizations demand high, constant availability of data and also desire data protection in the form of a backup, mirror copy of data. While data is being backed-up, access to the data may be unavailable. For this reason, it is important to provide a backup system that minimizes the time during which access to the data is unavailable. To satisfy such demands, IBM provides the Flash Copy procedure that provides an instantaneous point-in-time copy of a logical volume.
A Flash Copy operation involves creating a relationship between source and target volumes, where the target maintains the copy as of a point-in-time. As part of establishing the relationship, a data structure is created of the source volume. The data structure may comprise a bitmap of the source volume tracks or some other data structure. After the data structure is created, access to the source and target volumes subject to the Flash Copy may be resumed. Thus, read/write access to the source and target volumes is only blocked for the short time needed to create the data structure and establish a relationship between source and target volumes. At the time the data structure is created, the target volume is empty. A background operation then begins copying the tracks in the source volumes identified in the data structure to the corresponding target volumes. The data structure indicates which tracks in the source were copied over to the target.
If an application requests data from the target that has not yet been updated with the source data, then the data is read from the source; otherwise, the read can be satisfied from the target volume. Before an application can update a track on the source that has not yet been copied, the track is copied to the target volume. Subsequent reads to this track on the target volume are satisfied from the target volume. After some time, all tracks will have been copied to the target volume, and the Flash Copy relationship will end. If an application wants to update the target before the source data has been copied to the target, the data is first read from the source, written to the target, then updated by the application. The target volumes""s bitmap is updated to indicate that the copy has been made. Further details of the Flash Copy operation are described in the IBM publication entitled xe2x80x9cImplementing ESS Copy Services on UNIX and Windows NT,xe2x80x9d having IBM document no. SG24-5757-00 (Copyright IBM Corp., April, 2000), which publication is incorporated herein by reference in its entirety.
Many storage systems utilize a storage controller that controls access to a storage device that consists of numerous interconnected hard disk drives, such as a Direct Access Storage Device (DASD). When transferring data from a location, such as a source or target location, in the DASD to an application program at a host computer or writing data from the application to the DASD, the data sectors in the DASD are typically maintained in a cache device, such as a non-volatile storage unit.
There is a need in the art to ensure that data being transferred from a DASD location or cache during a read/write operation has not been corrupted or inadvertently altered by another process. Further, there is a need to provide for the checking of requested target blocks in a Flash Copy relationship when the source data has not yet been copied to the target blocks.
To overcome the limitations in the prior art described above, preferred embodiments disclose a method, system, program, and data structures for transferring data to a requesting application. A request is received for one or more blocks of data at contiguous addresses in a storage device. Each block of data includes customer data and metadata indicating the address of the block in the storage device and an error checking code that is capable of being used to determine whether the customer data in the block has changed. For each requested block, a determination is made as to whether the address of the block of data in the metadata and the requested address match. Further, for each requested block, an operation is performed on the customer data in the block and the error checking code to determine whether the customer data has changed. The requested block is transferred to the requesting application if the address of the block in the metadata and requested address match and the customer data has not changed.
In further embodiments, a control block is set-up indicating the block address of a first requested block at the first address of the requested contiguous addresses and whether to check the address and error code of the block. In such case, determining whether the block address in the metadata and the requested address match comprises using the block address in the control block as the requested address to compare with the block address in the metadata. For each requested block, the block address is incremented in the control block before processing a next block. In this way, the incremented block address is used as the requested address to compare with the block address in the metadata for the next requested block.
In yet further embodiments, indicating the block address in the control block comprises indicating a target address of a block having a corresponding source block that as not yet been copied to the block at the target address. In such case, transferring the requested block comprises transferring the customer data in the block at the source address.
In still further embodiments, the steps of determining whether the address of the block and block address in metadata match and performing the operation on the customer data and error checking is performed by a device that is separate from a main processor. This allows the transfer of the block of data from the storage device to the requesting application using a direct memory access (DMA) channel.
Still further, the requested blocks at contiguous addresses may comprise target blocks at contiguous target addresses in a copy relationship with source blocks at contiguous source addresses that have not yet been copied to the target blocks. In such case, the customer data and metadata in the block at the source address in the storage device to be copied to the requested target block are transferred to the cache. The block address in the metadata in the cache is replaced with the requested target address before determining whether the address of the block of data in the metadata in the cache and the requested target address match.
Preferred embodiments provide a technique for transferring data to a requesting application that utilizes metadata to ensure that the data being transferred is from the correct location in the storage device and that the data has not been changed while in the storage device. Further, preferred embodiments may be used when responding to a request for a target block address that is in a copy relationship, such as a Flash Copy relationship, with a source block address that has not yet been updated to the target block address. The preferred embodiments allow for the checking of data before transfer to the requesting application to ensure that the data has not been inadvertently overwritten or corrupted.
Further, the preferred embodiment use of metadata with the block of data may apply to data staged into cache before returning the data from the cache to the requesting application. The metadata in cache can be used to ensure that the requested data has not been inadvertently overwritten or corrupted while in cache pending transfer to the requesting application.